using NUnit.Framework;

namespace Crawler.Tests
{
	/// <summary>
	/// Summary description for TestDownloadStore.
	/// </summary>
	[TestFixture]
	public class TestDownloadStore
	{
		DownloadStore downloadStore;
		Key Key;
		private CrawlerContext crawlerContext;

		public TestDownloadStore() {
		}

		[SetUp]
		public void Initialize() {
			this.crawlerContext = new CrawlerContext();
			this.crawlerContext.UrlStackEmpty = true;
			downloadStore = new DownloadStore(this.crawlerContext);
			Key = new Key("key");
		}

		[Test]
		public void TestDownloadStoreCount() {
			Assertion.AssertEquals("",0,downloadStore.Count);
		}

		[Test]
		public void TestAdd() {
			Assertion.AssertEquals("",0,downloadStore.Count);
			downloadStore.Add(new Key("key"), new ResourceReference("data"));
			Assertion.AssertEquals("",1,downloadStore.Count);
		}

		[Test]
		public void TestRemove() {
			downloadStore.Add(Key, new ResourceReference("data"));
			Assertion.AssertEquals("",1,downloadStore.Count);
			downloadStore.Remove(Key);
			Assertion.AssertEquals("",0,downloadStore.Count);
		}
	}
}
